﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.BLL.ClientMobi.Message;
using System.Data;

namespace ZX.WebApp.Extend
{
    public partial class MsgreplyList : System.Web.UI.Page
    {
        private string msgID = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            msgID = Request["id"].ToString();
            if (!IsPostBack)
            {
                if (!IsPageParams()) return;
                InitData();
            }

        }

        private bool IsPageParams()
        {
            return (!string.IsNullOrEmpty(msgID)) ? true : false;
        }

        private void InitData()
        {
            IDictionary<string, object> sqlParamsList= new Dictionary<string, object>();

            IMessagePly MsgInstance = new RoleBase().Instance();

            string sql = @"select [ID] ,[MsgID] ,[UserID] ,[Content] ,convert(varchar(10),ReplyTime, 121) as ReplyTime ,[IsRead], UserName=(select UName From DatUser where UserID=x.userid), ChangeType From MsgReply as x where msgID='" + msgID + "'order by ReplyTime desc";
            sqlParamsList.Add("t-sql", sql);

            DataTable dt = MsgInstance.GetListByTSQL(sqlParamsList) as DataTable;
            if (dt != null && dt.Rows.Count > 0)
            {
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }

        }


    }
}